<?php

namespace Trois\MainServerRegister\Registers;

use EasySwoole\Component\Singleton;
use EasySwoole\EasySwoole\Swoole\EventRegister;
use EasySwoole\ORM\DbManager;
use Trois\Design\Observer\IObserver;

class OrmKeepRegister extends BaseRegister implements IObserver
{
    use Singleton;

    private function __construct(EventRegister $register)
    {
        parent::__construct($register);
    }

    public function update()
    {
        $this->register->add($this->register::onWorkerStart, function () {
            DbManager::getInstance()->getConnection()->__getClientPool()->keepMin();
        });
    }

}